package com.bwie.controller;

import com.bwie.entity.User;
import com.bwie.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/a")
    public String a(){
        return "login";
    }

    @RequestMapping("/login")
    @ResponseBody
    public Integer login(User user){
        return userService.login(user);
    }

    @RequestMapping("/add")
    public String add(){
        return "user_add";
    }

    @RequestMapping("/insertUser")
    @ResponseBody
    public Integer insertUser(User user){
        int i = userService.insertUser(user);
        return i;
    }

}
